﻿using System.Collections.Generic;
using KMF.Common;

namespace KMF.DAL
{
    public partial class NewsCategoryDb
    {
        public static List<NewsCategoryListMenuDto> GetAllNewsCategoryByType(string typ)
        {
            var dao = SharedSqlDao;
            var command = dao.GetDbSprocCommand("WSPX_Home_NewsCategory_GetAllByType");
            try
            {
                command.Parameters.Add(dao.CreateParameter("@Type", typ));
                var result = dao.GetDTOList<NewsCategoryListMenuDto>(ref command);
                return result;
            }
            finally
            {
                command.Connection.Close();
            }
        }
        public static NewsCategoryInfoDto GetAllNewsCategoryByType(int id)
        {
            var dao = SharedSqlDao;
            var command = dao.GetDbSprocCommand("WSPX_Home_NewsCategory_GetInfo");
            try
            {
                command.Parameters.Add(dao.CreateParameter("@NewsCategory", id));
                var result = dao.GetSingleDTO<NewsCategoryInfoDto>(ref command);
                return result;
            }
            finally
            {
                command.Connection.Close();
            }
        }

    }
}
